package com.hunttown.mes.rpc.domain.enums.expense;

import java.util.HashMap;
import java.util.Map;

/**
 * 报销状态 -10撤回 -1驳回 0无报销 1报销中 2已报销
 * created by wangjunfu on 2018/11/6
 */
public enum BXStatusEnum {
    STATUSF10(-10, "撤回"),
    STATUSF1(-1, "驳回"),
    STATUS0(0, "无报销"),
    STATUS1(1, "报销中"),
    STATUS2(2, "已报销"),
    STATUS10(10, "已拆单"); //针对借款单和支付单

    private final int key;
    private final String value;

    BXStatusEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (BXStatusEnum temp : BXStatusEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (BXStatusEnum temp : BXStatusEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
